package com.xhorse.lockplatform.comm.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.xhorse.lockplatform.comm.enums.ResultEnum;

/**
 * @author Tom
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResultUtil {

    public static Result success(Object object) {
        return new Result(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMsg(), object);
    }

    public static Result success() {
        return new Result(ResultEnum.SUCCESS.getCode(), ResultEnum.SUCCESS.getMsg());
    }

    public static Result failed(String code, String msg) {
        return new Result(code, msg);
    }

    public static Result failed() {
        return new Result(ResultEnum.FAILED.getCode(), ResultEnum.FAILED.getMsg());
    }
}
